package wms.api;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.support.SpringBootServletInitializer;
import org.springframework.context.annotation.AnnotationBeanNameGenerator;
import org.springframework.context.annotation.ComponentScan;
import wms.api.core.mybatis.base.BaseMapper;

/**
 * Created by fisher4u on 2017/11/24.
 */
@SpringBootApplication
@MapperScan(value = "**.mapper", markerInterface = BaseMapper.class, nameGenerator = WmsAPIApplication.SpringBeanNameGenerator.class)
@ComponentScan(nameGenerator = WmsAPIApplication.SpringBeanNameGenerator.class)
public class WmsAPIApplication extends SpringBootServletInitializer {
    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(WmsAPIApplication.class);
    }

    public static class SpringBeanNameGenerator extends AnnotationBeanNameGenerator {
        @Override
        protected String buildDefaultBeanName(BeanDefinition definition) {
            return definition.getBeanClassName();
        }
    }
    public static void main(String[] args) {
        SpringApplication.run(WmsAPIApplication.class, args);
    }

}
